// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package com.nnee.p_pr.p_c;

import android.content.*;
import android.database.Cursor;
import android.text.TextUtils;
import com.nnee.p_b.p_a.cls_d;
import com.nnee.p_b.p_b.p_e.cls_j;
import com.nnee.p_pr.p_atom.cls_b;
import com.nnee.p_pr.p_prot.cls_c;
import com.nnee.p_pr.p_prov.cls_af;
import java.util.HashMap;
import java.util.Map;

// Referenced classes of package com.nnee.p_pr.c:
//            f

public class cls_l
{

    public cls_l()
    {
    }

    public static Cursor a(Context context)
    {
        return a(context, com.nnee.p_b.p_a.cls_d.h().c());
    }

    public static Cursor a(Context context, String s)
    {
        Cursor cursor = null;
        if(context != null)
        {
            if(s == null)
                s = com.nnee.p_b.p_a.cls_d.h().c();
            ContentResolver contentresolver = context.getContentResolver();
            android.net.Uri uri = af.k;
            String as[] = a;
            String as1[] = new String[1];
            as1[0] = s;
            cursor = contentresolver.query(uri, as, "account =?", as1, cursor);
        }
        return cursor;
    }

    private static void a(ContentValues contentvalues, Cursor cursor, String s, int i1)
    {
        String s1 = cursor.getString(i1);
        if(s1 != null)
            contentvalues.put(s, s1);
    }

    public static void a(Context context, int i1)
    {
        if(context != null)
        {
            ContentResolver contentresolver = context.getContentResolver();
            android.net.Uri uri = af.k;
            String as[] = new String[2];
            as[0] = String.valueOf(i1);
            as[1] = com.nnee.p_b.p_a.cls_d.h().c();
            contentresolver.delete(uri, "type_weibo =?  AND account =? ", as);
        }
    }

    public static void a(Context context, String s, int i1, String s1, String s2, String s3, String s4, String s5)
    {
        a(context, com.nnee.p_b.p_a.cls_d.h().c(), s, i1, s1, s2, s3, s4, s5);
    }

    public static void a(Context context, String s, String s1)
    {
        if(!TextUtils.isEmpty(s1) && context != null)
        {
            if(s == null)
                s = com.nnee.p_b.p_a.cls_d.h().c();
            ContentResolver contentresolver = context.getContentResolver();
            android.net.Uri uri = af.k;
            String as[] = new String[2];
            as[0] = s1;
            as[1] = s;
            contentresolver.delete(uri, "name =? AND account =?", as);
        }
    }

    public static void a(Context context, String s, String s1, int i1, String s2, String s3, String s4, String s5, 
            String s6)
    {
        if(context != null && !TextUtils.isEmpty(s1))
        {
            if(s == null)
                s = com.nnee.p_b.p_a.cls_d.h().c();
            ContentResolver contentresolver = context.getContentResolver();
            android.net.Uri uri = af.k;
            String as[] = a;
            String as1[] = new String[3];
            as1[0] = s1;
            as1[1] = String.valueOf(i1);
            as1[2] = s;
            Cursor cursor = contentresolver.query(uri, as, "name =?  AND type_weibo =? AND account =?", as1, null);
            boolean flag = true;
            if(cursor == null || !cursor.moveToFirst())
                flag = false;
            if(cursor != null)
                cursor.close();
            if(flag)
            {
                ContentValues contentvalues = new ContentValues();
                contentvalues.put("token_weibo", s2);
                contentvalues.put("secret_weibo", s3);
                contentvalues.put("main_url", s4);
                contentvalues.put("portrait_url", s5);
                context.getContentResolver().update(af.k, contentvalues, "name =?  AND type_weibo =? AND account =?", null);
            } else
            {
                ContentValues contentvalues1 = new ContentValues();
                contentvalues1.put("token_weibo", s2);
                contentvalues1.put("secret_weibo", s3);
                contentvalues1.put("account", s);
                contentvalues1.put("name", s1);
                contentvalues1.put("type_weibo", Integer.valueOf(i1));
                contentvalues1.put("main_url", s4);
                contentvalues1.put("portrait_url", s5);
                context.getContentResolver().insert(af.k, contentvalues1);
            }
        }
    }

    public static boolean a(Context context, String s, int i1)
    {
        Cursor cursor;
        boolean flag;
        cursor = null;
        flag = true;
        if(s == null)
            s = com.nnee.p_b.p_a.cls_d.h().c();
        if(context != null) goto _L2; else goto _L1
_L1:
        if(cursor != null)
            cursor.close();
_L3:
        return flag;
_L2:
        Cursor cursor2;
        ContentResolver contentresolver = context.getContentResolver();
        android.net.Uri uri = af.k;
        String as[] = a;
        String as1[] = new String[2];
        as1[0] = String.valueOf(i1);
        as1[1] = s;
        cursor2 = contentresolver.query(uri, as, "type_weibo =? AND account =?", as1, null);
        Cursor cursor1;
        cursor1 = cursor2;
        if(cursor1 == null)
            break MISSING_BLOCK_LABEL_107;
        boolean flag2 = cursor1.moveToFirst();
        if(flag2)
            break MISSING_BLOCK_LABEL_193;
        boolean flag1 = false;
_L8:
        if(cursor1 != null)
            cursor1.close();
_L4:
        flag = flag1;
          goto _L3
        NullPointerException nullpointerexception;
        nullpointerexception;
        cursor1 = cursor;
_L7:
        nullpointerexception.printStackTrace();
        Exception exception;
        if(cursor1 != null)
        {
            cursor1.close();
            flag1 = flag;
        } else
        {
            flag1 = flag;
        }
          goto _L4
        exception;
_L6:
        if(cursor != null)
            cursor.close();
        throw exception;
        exception;
        cursor = cursor1;
        if(true) goto _L6; else goto _L5
_L5:
        nullpointerexception;
          goto _L7
        flag1 = flag;
          goto _L8
    }

    public static boolean a(Context context, String s, cls_b b1)
    {
        boolean flag = true;
        f.a[b1.ordinal()];
        JVM INSTR tableswitch 1 2: default 32
    //                   1 34
    //                   2 44;
           goto _L1 _L2 _L3
_L1:
        return flag;
_L2:
        flag = a(context, s, 3);
        continue; /* Loop/switch isn't completed */
_L3:
        flag = a(context, s, flag);
        if(true) goto _L1; else goto _L4
_L4:
    }

    public static String[] a(Context context, String s, String s1, int i1)
    {
        Object obj = null;
        if(context != null && !TextUtils.isEmpty(s1)) goto _L2; else goto _L1
_L1:
        return ((String []) (obj));
_L2:
        if(s == null)
            s = com.nnee.p_b.p_a.cls_d.h().c();
        ContentResolver contentresolver = context.getContentResolver();
        android.net.Uri uri = af.k;
        String as[] = a;
        String as1[] = new String[3];
        as1[0] = s1;
        as1[1] = String.valueOf(i1);
        as1[2] = s;
        Cursor cursor = contentresolver.query(uri, as, "name =?  AND type_weibo =?  AND account =?", as1, ((String) (obj)));
        obj = new String[2];
        if(cursor != null && cursor.moveToFirst())
        {
            obj[0] = cursor.getString(5);
            obj[1] = cursor.getString(6);
        }
        if(cursor != null)
            cursor.close();
        if(true) goto _L1; else goto _L3
_L3:
    }

    public static cls_j b(Context context, String s, int i1)
    {
        Object obj;
        Cursor cursor;
        obj = null;
        if(s == null)
            s = com.nnee.p_b.p_a.cls_d.h().c();
        ContentResolver contentresolver = context.getContentResolver();
        android.net.Uri uri = af.k;
        String as[] = a;
        String as1[] = new String[2];
        as1[0] = String.valueOf(i1);
        as1[1] = s;
        cursor = contentresolver.query(uri, as, "type_weibo =? AND account =?", as1, ((String) (obj)));
        if(cursor == null) goto _L2; else goto _L1
_L1:
        if(!cursor.moveToFirst()) goto _L2; else goto _L3
_L3:
        obj = new cls_j(i1);
        ((j) (obj)).d(cursor.getString(2));
        ((j) (obj)).b(cursor.getString(5));
        ((j) (obj)).c(cursor.getString(6));
        if(cursor != null)
            cursor.close();
_L5:
        return ((j) (obj));
_L2:
        if(cursor != null)
            cursor.close();
        if(true) goto _L5; else goto _L4
_L4:
        Exception exception;
        exception;
        if(cursor != null)
            cursor.close();
        throw exception;
    }

    public static Map b(Context context)
    {
        return b(context, com.nnee.p_b.p_a.cls_d.h().c());
    }

    public static Map b(Context context, String s)
    {
        Object obj = null;
        if(context != null)
        {
            if(s == null)
                s = com.nnee.p_b.p_a.cls_d.h().c();
            HashMap hashmap = new HashMap();
            ContentResolver contentresolver = context.getContentResolver();
            android.net.Uri uri = af.k;
            String as[] = a;
            String as1[] = new String[1];
            as1[0] = s;
            Cursor cursor = contentresolver.query(uri, as, "account =?", as1, ((String) (obj)));
            if(cursor != null && cursor.moveToFirst())
                do
                    hashmap.put(cursor.getString(1), cursor.getString(0));
                while(cursor.moveToNext());
            if(cursor != null)
                cursor.close();
            obj = hashmap;
        }
        return ((Map) (obj));
    }

    public static void b(Context context, String s, String s1, int i1)
    {
        if(!TextUtils.isEmpty(s1) && context != null && (i1 == 3 || i1 == 2 || i1 == 1))
        {
            if(s == null)
                s = com.nnee.p_b.p_a.cls_d.h().c();
            String s2 = (new StringBuilder()).append("name = '").append(s1).append("' AND ").append("account").append(" =?").toString();
            ContentValues contentvalues = new ContentValues();
            contentvalues.put("type_weibo", Integer.valueOf(i1));
            ContentResolver contentresolver = context.getContentResolver();
            android.net.Uri uri = af.k;
            String as[] = new String[1];
            as[0] = s;
            contentresolver.update(uri, contentvalues, s2, as);
        }
    }

    public static int c(Context context)
    {
        return c(context, com.nnee.p_b.p_a.cls_d.h().c());
    }

    public static int c(Context context, String s)
    {
        int i1 = 0;
        if(context != null)
        {
            if(s == null)
                s = com.nnee.p_b.p_a.cls_d.h().c();
            ContentResolver contentresolver = context.getContentResolver();
            android.net.Uri uri = af.k;
            String as[] = a;
            String as1[] = new String[1];
            as1[i1] = s;
            Cursor cursor = contentresolver.query(uri, as, "account =? ", as1, null);
            int j1;
            if(cursor != null)
            {
                j1 = cursor.getCount();
                cursor.close();
            } else
            {
                j1 = i1;
            }
            i1 = j1;
        }
        return i1;
    }

    public static String[] c(Context context, String s, int i1)
    {
        return a(context, com.nnee.p_b.p_a.cls_d.h().c(), s, i1);
    }

    public static void d(Context context, String s)
    {
        a(context, com.nnee.p_b.p_a.cls_d.h().c(), s);
    }

    public static void e(Context context, String s)
    {
        if(context != null && s != null && !s.equals(c.b))
        {
            ContentResolver contentresolver = context.getContentResolver();
            android.net.Uri uri = af.k;
            String as[] = a;
            String as1[] = new String[1];
            as1[0] = c.b;
            Cursor cursor = contentresolver.query(uri, as, "account =? ", as1, null);
            if(cursor != null)
            {
                if(cursor.moveToFirst())
                {
                    ContentResolver contentresolver1 = context.getContentResolver();
                    android.net.Uri uri1 = af.k;
                    String as2[] = new String[1];
                    as2[0] = s;
                    contentresolver1.delete(uri1, "account =? ", as2);
                    do
                    {
                        ContentValues contentvalues = new ContentValues();
                        a(contentvalues, cursor, "name", 2);
                        contentvalues.put("last_login", Long.valueOf(cursor.getLong(3)));
                        contentvalues.put("type_weibo", Integer.valueOf(cursor.getInt(4)));
                        a(contentvalues, cursor, "token_weibo", 5);
                        a(contentvalues, cursor, "secret_weibo", 6);
                        a(contentvalues, cursor, "main_url", 7);
                        a(contentvalues, cursor, "portrait_url", 8);
                        a(contentvalues, cursor, "other", 9);
                        contentvalues.put("account", s);
                        context.getContentResolver().insert(af.k, contentvalues);
                    } while(cursor.moveToNext());
                }
                cursor.close();
            }
        }
    }

    public static String a[];
    public static final int b = 0;
    public static final int c = 1;
    public static final int d = 2;
    public static final int e = 3;
    public static final int f = 4;
    public static final int g = 5;
    public static final int h = 6;
    public static final int i = 7;
    public static final int j = 8;
    public static final int k = 9;

    static 
    {
        String as[] = new String[10];
        as[0] = "_id";
        as[1] = "account";
        as[2] = "name";
        as[3] = "last_login";
        as[4] = "type_weibo";
        as[5] = "token_weibo";
        as[6] = "secret_weibo";
        as[7] = "main_url";
        as[8] = "portrait_url";
        as[9] = "other";
        a = as;
    }
}
